package com.meitianhui.convenitenbuy.module.store.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.meitianhui.convenitenbuy.R;

import java.util.List;

/**
 * Created by Administrator on 2017/11/23.
 */

public class StoreSelectTypeAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private int mCheckPosition = 0;
    public StoreSelectTypeAdapter(@Nullable List<String> data) {
        super(R.layout.item_store_select_type, data);
    }

    public void setCheckPosition(int checkPosition) {
        this.mCheckPosition = checkPosition;
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_type, item);
        if(helper.getLayoutPosition()==mCheckPosition){
            helper.setBackgroundRes(R.id.tv_type,R.drawable.hollow_cornor_shape);
            helper.setTextColor(R.id.tv_type, Color.parseColor("#ff4242"));
        }else{
            helper.setBackgroundRes(R.id.tv_type,R.color.transparent);
            helper.setTextColor(R.id.tv_type, Color.parseColor("#999999"));
        }

    }


}
